.template-page {
  padding: 0;
  background: #fff;
  min-height: 100vh;
  margin-left: 0;
}

/* 搜索框区域 */
.template-search-section {
  padding: 20px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.template-search-section .search-section {
  position: static;
  transform: none;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.template-search-section .search-container {
  max-width: 800px;
  margin: 0 auto;
}

/* 筛选区域 */
.filter-section {
  padding: 20px 20px 0 20px;
  background: #fff;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 8px 0;
  min-height: 40px;
}

.filter-label {
  width: 45px;
  font-size: 14px;
  color: #666;
  flex-shrink: 0;
  margin-right: 15px;
  margin-top: 6px;
  line-height: 28px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  transition: all 0.3s ease;
  align-items: flex-start;
  min-height: 28px;
}

.filter-option {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  height: 28px;
  line-height: 16px;
  box-sizing: border-box;
}

.filter-option:hover {
  background: #f5f5f5;
}

.filter-option.selected {
  background: #e0e0e0;
  color: #333;
  font-weight: 500;
}

.more-option {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #666;
}

.arrow-down {
  font-size: 10px;
  margin-left: 2px;
  transition: transform 0.3s ease;
}

.arrow-down.expanded {
  transform: rotate(180deg);
}

/* 排序和筛选选项 */
.sort-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
}

.sort-options {
  display: flex;
  gap: 20px;
}

.sort-option {
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-option:hover {
  color: #333;
}

.sort-option.selected {
  color: #333;
  font-weight: 500;
}

.new-tag {
  background: #ff4757;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: normal;
}

.filter-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.filter-select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: white;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  margin: 0;
}

/* 模板内容预览 */
.template-content {
  background: #f8f9fa;
  padding: 20px;
  height: calc(100vh - 400px);
  min-height: 600px;
}

/* 虚拟滚动容器样式 */
.template-content > div {
  /* 自定义滚动条样式 */
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

.template-content > div::-webkit-scrollbar {
  width: 8px;
}

.template-content > div::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.template-content > div::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.template-content > div::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
  background: #f8f9fa;
}

.template-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  width: 100%;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.card-image {
  height: 150px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.new-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

.premium-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ffa500;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 20px 12px 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.template-card:hover .card-overlay {
  opacity: 1;
}

.overlay-stats {
  display: flex;
  justify-content: space-between;
  color: white;
  font-size: 12px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.placeholder-image {
  font-size: 16px;
  color: #666;
  text-align: center;
  padding: 20px;
}

.placeholder-image.lychee {
  background: linear-gradient(135deg, #ff6b6b, #ffa500);
  color: white;
  font-weight: bold;
}

.placeholder-image.chat {
  background: linear-gradient(135deg, #4ecdc4, #44a08d);
  color: white;
  font-weight: bold;
}

.placeholder-image.data {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: bold;
}

.placeholder-image.star {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  font-weight: bold;
}

.card-title {
  padding: 12px;
  font-size: 14px;
  color: #333;
  text-align: center;
  border-top: 1px solid #f0f0f0;
  background: white;
}

.card-tags {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tag {
  background: #f0f0f0;
  color: #666;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  background: white;
  border-radius: 8px;
  margin: 20px;
}

.no-results p {
  margin-bottom: 20px;
  font-size: 16px;
}

.no-results button {
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.no-results button:hover {
  background: #0056b3;
}

/* 底部推广区域 */
.promotion-section {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 40px 20px;
  text-align: center;
  margin-top: 40px;
}

.promotion-content h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 500;
}

.features {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.feature-icon {
  font-size: 18px;
}

.login-now-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-now-btn:hover {
  background: #0056b3;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .template-page {
    padding: 10px 10px 10px 2px;
  }
  .filter-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-label {
    width: auto;
    margin-bottom: 8px;
    margin-right: 0;
    margin-top: 0;
  }
  .filter-options {
    width: 100%;
  }
  .sort-section {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .sort-options {
    width: 100%;
    justify-content: space-between;
  }
  .filter-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .template-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .template-grid {
    grid-template-columns: 1fr;
  }
}
